package com.rabbitmq.extension.listener;

import com.rabbitmq.client.Channel;
import com.rabbitmq.extension.constant.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;
import java.util.Date;

//@Component
public class DLListener {
    @RabbitListener(queues = Constants.DL_QUEUE)
    public void DLListener(Message message, Channel channel) throws UnsupportedEncodingException {
        System.out.printf("%tc 死信队列接收到信息: %s%n",new Date(),new String(message.getBody(),"UTF-8"));
    }

}
